.class Lcom/evernote/client/android/EvernoteOAuthActivity$CompleteAuthAsyncTask;
.super Landroid/os/AsyncTask;
.source "EvernoteOAuthActivity.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/evernote/client/android/EvernoteOAuthActivity;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "CompleteAuthAsyncTask"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/os/AsyncTask",
        "<",
        "Landroid/net/Uri;",
        "Ljava/lang/Void;",
        "Lcom/evernote/client/oauth/EvernoteAuthToken;",
        ">;"
    }
.end annotation


# instance fields
.field final synthetic this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;


# direct methods
.method private constructor <init>(Lcom/evernote/client/android/EvernoteOAuthActivity;)V
    .registers 2

    .prologue
    .line 473
    iput-object p1, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$CompleteAuthAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    invoke-direct {p0}, Landroid/os/AsyncTask;-><init>()V

    return-void
.end method

.method synthetic constructor <init>(Lcom/evernote/client/android/EvernoteOAuthActivity;Lcom/evernote/client/android/EvernoteOAuthActivity$1;)V
    .registers 3
    .param p1, "x0"    # Lcom/evernote/client/android/EvernoteOAuthActivity;
    .param p2, "x1"    # Lcom/evernote/client/android/EvernoteOAuthActivity$1;

    .prologue
    .line 473
    invoke-direct {p0, p1}, Lcom/evernote/client/android/EvernoteOAuthActivity$CompleteAuthAsyncTask;-><init>(Lcom/evernote/client/android/EvernoteOAuthActivity;)V

    return-void
.end method


# virtual methods
.method protected varargs doInBackground([Landroid/net/Uri;)Lcom/evernote/client/oauth/EvernoteAuthToken;
    .registers 14
    .param p1, "uris"    # [Landroid/net/Uri;

    .prologue
    .line 482
    const/4 v1, 0x0

    .line 483
    .local v1, "authToken":Lcom/evernote/client/oauth/EvernoteAuthToken;
    if-eqz p1, :cond_6

    array-length v10, p1

    if-nez v10, :cond_8

    .line 484
    :cond_6
    const/4 v10, 0x0

    .line 511
    :goto_7
    return-object v10

    .line 486
    :cond_8
    const/4 v10, 0x0

    aget-object v7, p1, v10

    .line 488
    .local v7, "uri":Landroid/net/Uri;
    iget-object v10, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$CompleteAuthAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # getter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mRequestToken:Ljava/lang/String;
    invoke-static {v10}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$1100(Lcom/evernote/client/android/EvernoteOAuthActivity;)Ljava/lang/String;

    move-result-object v10

    invoke-static {v10}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v10

    if-nez v10, :cond_6f

    .line 489
    iget-object v10, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$CompleteAuthAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # invokes: Lcom/evernote/client/android/EvernoteOAuthActivity;->createService()Lorg/scribe/oauth/OAuthService;
    invoke-static {v10}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$1000(Lcom/evernote/client/android/EvernoteOAuthActivity;)Lorg/scribe/oauth/OAuthService;

    move-result-object v6

    .line 490
    .local v6, "service":Lorg/scribe/oauth/OAuthService;
    const-string v10, "oauth_verifier"

    invoke-virtual {v7, v10}, Landroid/net/Uri;->getQueryParameter(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v9

    .line 491
    .local v9, "verifierString":Ljava/lang/String;
    const-string v10, "sandbox_lnb"

    invoke-virtual {v7, v10}, Landroid/net/Uri;->getQueryParameter(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 492
    .local v0, "appLnbString":Ljava/lang/String;
    const-string v10, "true"

    invoke-virtual {v10, v0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v4

    .line 494
    .local v4, "isAppLinkedNotebook":Z
    invoke-static {v9}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v10

    if-eqz v10, :cond_3e

    .line 495
    const-string v10, "EvernoteOAuthActivity"

    const-string v11, "User did not authorize access"

    invoke-static {v10, v11}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .end local v0    # "appLnbString":Ljava/lang/String;
    .end local v4    # "isAppLinkedNotebook":Z
    .end local v6    # "service":Lorg/scribe/oauth/OAuthService;
    .end local v9    # "verifierString":Ljava/lang/String;
    :goto_3c
    move-object v10, v1

    .line 511
    goto :goto_7

    .line 497
    .restart local v0    # "appLnbString":Ljava/lang/String;
    .restart local v4    # "isAppLinkedNotebook":Z
    .restart local v6    # "service":Lorg/scribe/oauth/OAuthService;
    .restart local v9    # "verifierString":Ljava/lang/String;
    :cond_3e
    new-instance v8, Lorg/scribe/model/Verifier;

    invoke-direct {v8, v9}, Lorg/scribe/model/Verifier;-><init>(Ljava/lang/String;)V

    .line 498
    .local v8, "verifier":Lorg/scribe/model/Verifier;
    const-string v10, "EvernoteOAuthActivity"

    const-string v11, "Retrieving OAuth access token..."

    invoke-static {v10, v11}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 500
    :try_start_4a
    new-instance v5, Lorg/scribe/model/Token;

    iget-object v10, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$CompleteAuthAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # getter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mRequestToken:Ljava/lang/String;
    invoke-static {v10}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$1100(Lcom/evernote/client/android/EvernoteOAuthActivity;)Ljava/lang/String;

    move-result-object v10

    iget-object v11, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$CompleteAuthAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # getter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mRequestTokenSecret:Ljava/lang/String;
    invoke-static {v11}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$1200(Lcom/evernote/client/android/EvernoteOAuthActivity;)Ljava/lang/String;

    move-result-object v11

    invoke-direct {v5, v10, v11}, Lorg/scribe/model/Token;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    .line 501
    .local v5, "reqToken":Lorg/scribe/model/Token;
    new-instance v2, Lcom/evernote/client/oauth/EvernoteAuthToken;

    invoke-interface {v6, v5, v8}, Lorg/scribe/oauth/OAuthService;->getAccessToken(Lorg/scribe/model/Token;Lorg/scribe/model/Verifier;)Lorg/scribe/model/Token;

    move-result-object v10

    invoke-direct {v2, v10, v4}, Lcom/evernote/client/oauth/EvernoteAuthToken;-><init>(Lorg/scribe/model/Token;Z)V
    :try_end_64
    .catch Ljava/lang/Exception; {:try_start_4a .. :try_end_64} :catch_66

    .end local v1    # "authToken":Lcom/evernote/client/oauth/EvernoteAuthToken;
    .local v2, "authToken":Lcom/evernote/client/oauth/EvernoteAuthToken;
    move-object v1, v2

    .line 505
    .end local v2    # "authToken":Lcom/evernote/client/oauth/EvernoteAuthToken;
    .restart local v1    # "authToken":Lcom/evernote/client/oauth/EvernoteAuthToken;
    goto :goto_3c

    .line 503
    .end local v5    # "reqToken":Lorg/scribe/model/Token;
    :catch_66
    move-exception v3

    .line 504
    .local v3, "ex":Ljava/lang/Exception;
    const-string v10, "EvernoteOAuthActivity"

    const-string v11, "Failed to obtain OAuth access token"

    invoke-static {v10, v11, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_3c

    .line 508
    .end local v0    # "appLnbString":Ljava/lang/String;
    .end local v3    # "ex":Ljava/lang/Exception;
    .end local v4    # "isAppLinkedNotebook":Z
    .end local v6    # "service":Lorg/scribe/oauth/OAuthService;
    .end local v8    # "verifier":Lorg/scribe/model/Verifier;
    .end local v9    # "verifierString":Ljava/lang/String;
    :cond_6f
    const-string v10, "EvernoteOAuthActivity"

    const-string v11, "Unable to retrieve OAuth access token, no request token"

    invoke-static {v10, v11}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_3c
.end method

.method protected bridge synthetic doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
    .registers 3

    .prologue
    .line 473
    check-cast p1, [Landroid/net/Uri;

    invoke-virtual {p0, p1}, Lcom/evernote/client/android/EvernoteOAuthActivity$CompleteAuthAsyncTask;->doInBackground([Landroid/net/Uri;)Lcom/evernote/client/oauth/EvernoteAuthToken;

    move-result-object v0

    return-object v0
.end method

.method protected onPostExecute(Lcom/evernote/client/oauth/EvernoteAuthToken;)V
    .registers 7
    .param p1, "authToken"    # Lcom/evernote/client/oauth/EvernoteAuthToken;

    .prologue
    const/16 v1, 0x2710

    .line 520
    iget-object v2, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$CompleteAuthAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    const/16 v3, 0x65

    invoke-virtual {v2, v3}, Lcom/evernote/client/android/EvernoteOAuthActivity;->removeDialog(I)V

    .line 521
    invoke-static {}, Lcom/evernote/client/android/EvernoteSession;->getOpenSession()Lcom/evernote/client/android/EvernoteSession;

    move-result-object v2

    if-nez v2, :cond_15

    .line 522
    iget-object v2, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$CompleteAuthAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    # invokes: Lcom/evernote/client/android/EvernoteOAuthActivity;->exit(I)V
    invoke-static {v2, v1}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$400(Lcom/evernote/client/android/EvernoteOAuthActivity;I)V

    .line 529
    :goto_14
    return-void

    .line 526
    :cond_15
    invoke-static {}, Lcom/evernote/client/android/EvernoteSession;->getOpenSession()Lcom/evernote/client/android/EvernoteSession;

    move-result-object v2

    iget-object v3, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$CompleteAuthAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    invoke-virtual {v3}, Lcom/evernote/client/android/EvernoteOAuthActivity;->getApplicationContext()Landroid/content/Context;

    move-result-object v3

    iget-object v4, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$CompleteAuthAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    .line 527
    # getter for: Lcom/evernote/client/android/EvernoteOAuthActivity;->mSelectedBootstrapProfile:Lcom/evernote/edam/userstore/BootstrapProfile;
    invoke-static {v4}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$600(Lcom/evernote/client/android/EvernoteOAuthActivity;)Lcom/evernote/edam/userstore/BootstrapProfile;

    move-result-object v4

    invoke-virtual {v4}, Lcom/evernote/edam/userstore/BootstrapProfile;->getSettings()Lcom/evernote/edam/userstore/BootstrapSettings;

    move-result-object v4

    invoke-virtual {v4}, Lcom/evernote/edam/userstore/BootstrapSettings;->getServiceHost()Ljava/lang/String;

    move-result-object v4

    .line 526
    invoke-virtual {v2, v3, p1, v4}, Lcom/evernote/client/android/EvernoteSession;->persistAuthenticationToken(Landroid/content/Context;Lcom/evernote/client/oauth/EvernoteAuthToken;Ljava/lang/String;)Z

    move-result v0

    .line 528
    .local v0, "success":Z
    iget-object v2, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$CompleteAuthAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    if-eqz v0, :cond_36

    const/4 v1, -0x1

    :cond_36
    # invokes: Lcom/evernote/client/android/EvernoteOAuthActivity;->exit(I)V
    invoke-static {v2, v1}, Lcom/evernote/client/android/EvernoteOAuthActivity;->access$400(Lcom/evernote/client/android/EvernoteOAuthActivity;I)V

    goto :goto_14
.end method

.method protected bridge synthetic onPostExecute(Ljava/lang/Object;)V
    .registers 2

    .prologue
    .line 473
    check-cast p1, Lcom/evernote/client/oauth/EvernoteAuthToken;

    invoke-virtual {p0, p1}, Lcom/evernote/client/android/EvernoteOAuthActivity$CompleteAuthAsyncTask;->onPostExecute(Lcom/evernote/client/oauth/EvernoteAuthToken;)V

    return-void
.end method

.method protected onPreExecute()V
    .registers 3

    .prologue
    .line 477
    iget-object v0, p0, Lcom/evernote/client/android/EvernoteOAuthActivity$CompleteAuthAsyncTask;->this$0:Lcom/evernote/client/android/EvernoteOAuthActivity;

    const/16 v1, 0x65

    invoke-virtual {v0, v1}, Lcom/evernote/client/android/EvernoteOAuthActivity;->showDialog(I)V

    .line 478
    return-void
.end method
